#!/bin/bash

# <--------------------------------------->
sudo chmod o-x /sbin/reboot
sudo chmod o-x /sbin/shutdown
# export LANG=en_US.UTF-8
# export LC_ALL=en_US.UTF-8

sh cfg_install.sh

if command -v apt > /dev/null; then
  sh env_install_apt.sh
else
  sh env_install_dnf.sh
fi

echo "~ Now install rust, python, nodejs"

# <--------------------------------------->
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
cp -r ./.cargo ~/

# 安装缓存管理工具
cargo install cargo-cache

# 清理缓存和锁文件
cargo-cache

#cargo install hyperfine

# curl -fsSL https://cli.moonbitlang.cn/install/unix.sh | bash

# <--------------------------------------->
curl -LsSf https://astral.sh/uv/install.sh | sh
# wget -qO- https://astral.sh/uv/install.sh | sh
if command -v uv > /dev/null; then
	uv tool install ruff@latest
fi

# <--------------------------------------->
# https://nodejs.org/en/download/

# sudo apt install -y nodejs npm

sh zsh_install.sh
sh zsh_config.sh

exit

# <--------------------------------------->
#执行 sudo chmod 775 /mnt/_projects/ 后，权限没有变化的原因是由于 VBoxSF (VirtualBox Shared Folders) 的特殊性。
#查看 vboxsf 组中的所有成员
getent group vboxsf
#将当前用户添加到 vboxsf 组
sudo usermod -aG vboxsf $USER
newgrp vboxsf

#sudo firewall-cmd --permanent --add-port=33/tcp
#sudo firewall-cmd --reload
#sudo ufw allow 22/tcp
#sudo ufw reload

# 关闭 Ubuntu 系统的自动更新
dconf write /com/ubuntu/update-notifier/release-upgrades/enabled false
dconf write /com/ubuntu/update-notifier/prompt-count 0

sudo systemctl disable unattended-upgrades
sudo apt-get remove unattended-upgrades

sudo apt-get remove gnome-software
sudo echo "X-GNOME-Autostart-enabled=false" >> /etc/xdg/autostart/update-notifier.desktop

